package cn.iocoder.yudao.module.javainfo.dal.mysql.user;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.javainfo.dal.dataobject.user.UserDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.javainfo.controller.admin.user.vo.*;

/**
 * 用户 Mapper
 *
 * @author 爪哇国大BOSS
 */
@Mapper
public interface JavaInfoUserMapper extends BaseMapperX<UserDO> {

    default PageResult<UserDO> selectPage(UserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserDO>()
                .likeIfPresent(UserDO::getUserName, reqVO.getUserName())
                .eqIfPresent(UserDO::getPhone, reqVO.getPhone())
                .eqIfPresent(UserDO::getAddress, reqVO.getAddress())
                .eqIfPresent(UserDO::getWechatOpenid, reqVO.getWechatOpenid())
                .orderByDesc(UserDO::getId));
    }

}